#pragma once

#include "WTSXSipService/SipWTSXServiceItf.hpp"


using namespace wtsxsip;

class CResipTesterDlg;

class CSessionHandler: 
    public ISipTranSessionHandle, 
    public ISipDlgSessionBaseHandle
{
public:

    CSessionHandler(CResipTesterDlg& dlg, ISipTranSession& ts);

    CSessionHandler(CResipTesterDlg& dlg, ISipDlgSessionBase& ds);

    ~CSessionHandler(void);

    /////////////////// Transaction Handle ////////////////////////////

    virtual bool onRequest(ISipTranSession& tran, const SHeaders& headers, const SMsgBodyBase& body);

    virtual bool onResponse(ISipTranSession& tran, const SHeaders& headers, const SMsgBodyBase& body);

    virtual bool onState(ISipTranSession& tran, const ISipTranSession::ETranSessionState newState);

    virtual bool onDestroy(ISipTranSession& tran);

    ///////////////////// Dialog Handle ///////////////////////////

    virtual bool onRequest(ISipDlgSessionBase& dlg, const SHeaders& headers, 
        const SMsgBodyBase& body, ISipTranSession& srvTran);

    virtual bool onResponse(ISipDlgSessionBase& dlg, const SHeaders& headers,
        const SMsgBodyBase& body, ISipTranSession& clnTran);

    virtual bool onState(ISipDlgSessionBase& dlg, const ISipDlgSessionBase::EDlgSessionState newState);

    virtual bool onDestroy(ISipDlgSessionBase& dlg);


private:

    CResipTesterDlg& m_dlg;

    ISipTranSession* m_ts;

    ISipDlgSessionBase* m_ds;

    uint32_t m_id;
};

